import React from "react";
import {BrowserRouter, Link, Navigate, Route, Routes} from 'react-router-dom'
import Login from "./pages/login";
import WebSSH from "./pages/ssh";
import NotFound from "./components/NotFound";
import MainLayout from "@/components/Layout";
import Oauth from '@/pages/oauth'
import CallBack from '@/pages/oauth/callback'
import {BASENAME} from "@/common/constant";
import './App.css'

function App() {
  return (
    <div className="App">
      <BrowserRouter basename={BASENAME}>
        <Routes>
          <Route path="/login" element={<Login/>}/>
          <Route path="/uaa" element={<Oauth/>}/>
          <Route path="/callback" element={<CallBack/>}/>
          <Route path="/ssh" element={<WebSSH/>}/>

          <Route path="/" element={<Main/>}>
            <Route path="*" element={<NotFound/>}/>
          </Route>

          <Route path="*" element={<NotFound/>}/>
        </Routes>
      </BrowserRouter>
    </div>
  )
}

function Main() {
  return <MainLayout/>
  // return localStorage.getItem(LOGIN_INFO) ? <MainLayout/> : <Navigate to="/login"/>;
}

export default App
